package com.yixun.mybatis;

import org.apache.commons.lang.StringUtils;

import java.util.List;

public class MapperUtil {
	public static boolean isNotEmpty(Object obj){
		if(obj instanceof String){
			return StringUtils.isNotBlank((String)obj);
		}else if(obj instanceof Boolean){
			return (Boolean)obj;
		}else{
			return obj != null;
		}
	}
	
	public static boolean allowEmptyString(Object obj){
		if(obj==null){
			return true;
		}else if(obj instanceof String){
			if("".equals((String)obj)){
				return false;
			}else{
				return StringUtils.isNotBlank((String)obj);
			}
		}else if(obj instanceof Boolean){
			return (Boolean)obj;
		}else{
			return obj != null;
		}
	}

	public static boolean checkList(Object list){
		if(list == null ){
			return false;
		}
		if(((List)list).size() == 0){
			return false;
		}
		return true;
	}
/*	public static boolean allowEmptyString(Object obj){
		if(obj instanceof String){
			if("".equals((String)obj)){
				return true;
			}else{
				return StringUtils.isNotBlank((String)obj);
			}
			
		}else if(obj instanceof Boolean){
			return (Boolean)obj;
		}else{
			return obj != null;
		}
	}
*/	
}
